Hi all, |
Re: Counting regex matches
Regexp re = regexp2("([0-9][0-9][0-9][0-9])(.*)")
void Count(string InString)
{
int Count = 0
string Remainder = InString
while (re Remainder)
{ Count++
if (Count < 6) print Remainder "\t[" Remainder[match 1] "]\t[" Remainder[match 2]"]\n"
Remainder = Remainder[match 2] // the (.*) in the re
}
infoBox("[" InString "] = " Count "")
}
Count("1234, 2345, 3456, 4567")
|
Re: Counting regex matches llandale - Wed Apr 25 16:19:36 EDT 2012
Regexp re = regexp2("([0-9][0-9][0-9][0-9])(.*)")
void Count(string InString)
{
int Count = 0
string Remainder = InString
while (re Remainder)
{ Count++
if (Count < 6) print Remainder "\t[" Remainder[match 1] "]\t[" Remainder[match 2]"]\n"
Remainder = Remainder[match 2] // the (.*) in the re
}
infoBox("[" InString "] = " Count "")
}
Count("1234, 2345, 3456, 4567")
|